package com.ddwl.goods.controller;


import com.ddwl.common.controller.BaseController;
import com.ddwl.goods.dao.model.ItemParam;
import com.ddwl.goods.service.ItemParamService;
import com.ddwl.schema.bo.base.PageBo;
import com.ddwl.schema.bo.goods.ItemParamBo;
import com.ddwl.schema.bo.goods.ItemParamCreateBo;
import com.ddwl.schema.vo.base.PageVo;
import com.ddwl.schema.vo.base.RestVo;
import com.ddwl.schema.vo.goods.ItemParamListVo;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Api(tags = "商品参数服务")
@RequestMapping("itemParam")
public class ItemParamController extends BaseController {
    @Autowired
    public ItemParamService itemParamService;

    @PostMapping("create")
    public RestVo<List<String>> create(@RequestBody ItemParamCreateBo itemParamCreateBo){
        return RestVo.ok(itemParamService.create(itemParamCreateBo));
    }
    @PostMapping("update")
    public RestVo<Integer> update(@RequestBody ItemParamCreateBo itemParamCreateBo){
        itemParamService.update(itemParamCreateBo);
        return RestVo.ok();
    }

    @PostMapping("list")
    public RestVo<PageVo<ItemParamListVo>> list(@RequestBody PageBo<ItemParam> bo){
        return RestVo.ok(itemParamService.list(bo));
    }
}
